<?php
Session_start();
	if(empty($_SESSION['username'])){
		//当用户没有登录的时候，就跳转到登录页面
		header('location:http://heika.91xundai.com/login.php');exit();
	}
 ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>留言查看</title>
        <meta name="keywords" content="" />
	<style type="text/css">
	table.gridtable {
		width:80%;
		margin:0 auto;
		
	}
table.gridtable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}
table.gridtable th {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}
table.gridtable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}
        .time_input{width:80%;margin:auto;padding:10px 0;overflow:hidden;}
        .time_input span{display:inline-block;font-size:14px;line-height:34px;vertical-align:top;}
    .time_input input{display:inline-block;font-size:14px;height:32px;text-align:center;padding:0;margin:0;border:#ddd 1px solid;vertical-align:top;}
    .time_input a{display:inline-block;font-size:14px;line-height:34px;background-color:#f60;color:#fff;padding:0 20px;text-decoration:none;border-radius:5px;vertical-align:top;}
</style>
    </head>
	<body>
<!-- Table goes in the document BODY -->
<div class="time_input">
    <span>按时间段导出：</span>
    <input id="bg-time" placeholder="开始时间">
    <span> - </span>
    <input id="end-time" placeholder="截止时间">
    <a href="javascript:;" id="export">导出数据</a>
</div>
<table class="gridtable">
<tr>
	<th>姓名</th>
	<th>手机号</th>
	<th>贷款金额</th>
	<th>时间</th>	
</tr>
<?php

	require_once ('controller/class.db.php');
	$db = new DB();

 	$res = $db->get_results('select * from dk_msg');

 ?>

<?php foreach($res as $k=>$v) { ?>
<tr>
	<td><?php echo $v['username']; ?></td>
	<td><?php echo $v['mobile']; ?></td>
	<td>---</td>
	<td><?php echo $v['time']; ?></td>
</tr>
<?php } ?>
</table>
<script type="text/javascript" src="http://www.sucaihuo.com/Public/js/other/jquery.js"></script>
<script src="layer/layer.js"></script>
<script src="laydate/laydate.js"></script> <!-- 改成你的路径 -->
<script>
    //执行一个laydate实例
    laydate.render({
        elem: '#bg-time' //指定元素
    });
    laydate.render({
        elem: '#end-time' //指定元素
    });
    $("#export").on("click",function(){
        var bgtime = $("#bg-time").val();
        var endtime = $("#end-time").val();
        if (bgtime=="") {
            layer.alert('请选择开始时间');
            return false;
        }
        if (endtime=="") {
            layer.alert('请选择结束时间');
            return false;
        }
        var URL="controller/export.php";
        window.location.href = URL+"?bg="+bgtime+"&end="+endtime;

    });
</script>
    </body>
</html>